package groep1.graph.dialog;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class HelpDialog extends JDialog {

	private static HelpDialog instance;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private HelpDialog() {

		Box b = Box.createVerticalBox();
		b.add(Box.createGlue());
		b.add(new JLabel("Filter adhv de juiste parameter:"));
		b.add(new JLabel("v - naam veld, t - type"));
		b.add(new JLabel("w - waarde, k - naam klasse"));
		b.add(new JLabel("p - naam pakket, o - object"));
		b.add(new JLabel("Na elke parameter volgt een dubbele"));
		b.add(new JLabel("punt en de juist reguliere expressie"));
		b.add(new JLabel("omsloten door accolades."));
		b.add(new JLabel("vb: t:{int}"));
		b.add(new JLabel("Deze filters kunnen verbonden worden"));
		b.add(new JLabel("met de operatoren 'en' 'of' en 'niet'."));
		b.add(new JLabel("Let erop dat de operatoren steeds voor-"));
		b.add(new JLabel("en nagegaan worden door een spatie."));
		b.add(Box.createGlue());
		getContentPane().add(b, "Center");

		JPanel p2 = new JPanel();
		JButton ok = new JButton("Ok");
		p2.add(ok);
		getContentPane().add(p2, "South");

		ok.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				setVisible(false);
			}
		});

		Toolkit toolkit = Toolkit.getDefaultToolkit();
		Dimension screenSize = toolkit.getScreenSize();
		Dimension dialogSize = new Dimension(320,320);
		
		setBounds((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2,dialogSize.width,dialogSize.height);
	}

	/*
	 * Test
	 */
	public static void main(String[] args) {
		JDialog f = getInstance();
		f.setVisible(true);		
	}
	

	public static HelpDialog getInstance(){
		if(instance == null){
			instance = new HelpDialog();	  
		}
		return instance;		  
	}

}
